#include "stdint.h"
#include "pthread.h"
#include "list.h"

#define RET_QUEUE_FULL -10
#define RET_QUEUE_EMPTY -9
struct ring_queue
{
	struct list_head ring_queue_list;
	uint32_t max_node_sum;
	uint32_t cur_node_sum;
	pthread_mutex_t mutex;
};

struct ring_queue_node
{
	void *data;
	uint32_t node_size;
	struct list_head list;
};

struct ring_queue *ring_queue_init(uint32_t max_node_sum);
void ring_queue_deinit(struct ring_queue *mrq);
struct ring_queue_node *get_ring_queue_node(struct ring_queue *mrq, uint8_t tail_flag);
int32_t ring_queue_write(struct ring_queue *mrq, void *data, uint32_t size, uint8_t tail_flag, uint8_t overwrite_flag, uint8_t overwrite_tail);
int32_t ring_queue_read(struct ring_queue *mrq, void **data, uint32_t *size, uint8_t tail_flag);
int32_t ring_queue_delete(struct ring_queue *mrq, void **data, uint8_t tail_flag);
void list_each_print(struct ring_queue *mrq);
